-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#988: Improved error message from CTPG parser. #466
#988: Improved error message from CTPG parser. #466
Conversation
d0cc304
to
7cc7bd5
Compare
std::string line = code.substr(currentLinePositions->mStartPos, | ||
currentLinePositions->mEndPos - currentLinePositions->mStartPos); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was actually a bug.
It's std::string::subst(begin, length), not std::string::subst(begin, end)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this change something on the performance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here results of our performance tests:
Master branch: 6.9s
This branch: 7.0s
TEST(ScriptOptionLinesTest, need_option_termination_character_second_line) { | ||
const std::string code = | ||
"%optionA myoption;\n" | ||
"%optionB myoption\n" | ||
"\nmycode"; | ||
options_map_t result; | ||
EXPECT_THROW({ | ||
try | ||
{ | ||
parseOptions(code, result); | ||
} | ||
catch( const OptionParserException& e ) | ||
{ | ||
// and this tests that it has the correct message | ||
EXPECT_STREQ( e.what(), "Error parsing script options at line 1: [1:18] PARSE: Syntax error: Unexpected '<eof>'\n"); | ||
throw; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would consider spliting the test into two test.
(try catch within the EXPECT_THROW
lets my spidy sense tingle ;P )
- Tests if the exception is thrown
- Tests if the error message is the expected one
related to exasol/script-languages-release#988
Also fixes a bug in the parser implementation which could have passed more than one line to the parser.